#!/bin/bash

area_name=$1

function remove_module_area # module version
{
    echo "Attempting to remove $1 $2"
    rm -f $(cvs-module-path $1 $2)/src/import.imk
    cvs -fQ update $(cvs-module-path $1 $2)/src
    cvs-retire-version -q $1 $2 current
}

for f in $(ls -d /usr/mitra-dev/src/*/${area_name} | cut -f5 -d/)
do
    remove_module_area ${f} ${area_name}
done

for f in $(ls -d /usr/oem-dev/*/*/${area_name} | cut -f4-5 -d/)
do
    remove_module_area $(echo ${f} | tr '/' '-') ${area_name}
done